﻿using Microsoft.EntityFrameworkCore;
using PJ.DBModel.Mappings;

namespace PJ.DBModel.Models
{
    public class zlwebContext : DbContext
    {
        public zlwebContext(DbContextOptions<zlwebContext> options)
            : base(options)
        {

        }

        public DbSet<Button> Button { get; set; }

        public DbSet<Donation> Donation { get; set; }

        public DbSet<Itemsdetail> Itemsdetail { get; set; }

        public DbSet<Items> Items { get; set; }

        public DbSet<Logonlog> Logonlog { get; set; }

        public DbSet<Module> Module { get; set; }

        public DbSet<Organize> Organize { get; set; }

        public DbSet<Roleauthorize> Roleauthorize { get; set; }

        public DbSet<Role> Role { get; set; }

        public DbSet<Taskschedule> Taskschedule { get; set; }

        public DbSet<Users> Users { get; set; }

        /// <summary>
        /// 配置实体约定并映射
        /// </summary>
        /// <param name="modelBuilder"></param>
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfiguration(new ButtonMap());
            modelBuilder.ApplyConfiguration(new DonationMap());
            modelBuilder.ApplyConfiguration(new ItemsdetailMap());
            modelBuilder.ApplyConfiguration(new ItemsMap());
            modelBuilder.ApplyConfiguration(new LogonlogMap());
            modelBuilder.ApplyConfiguration(new ModuleMap());
            modelBuilder.ApplyConfiguration(new OrganizeMap());
            modelBuilder.ApplyConfiguration(new RoleauthorizeMap());
            modelBuilder.ApplyConfiguration(new RoleMap());
            modelBuilder.ApplyConfiguration(new TaskscheduleMap());
            modelBuilder.ApplyConfiguration(new UsersMap());
            base.OnModelCreating(modelBuilder);
        }
    }
}
